const express = require('express')
const cors = require('cors')
const app = express()
const port = 3001

app.use(cors())

app.get('/api/leftList', (req, res) => {
  res.json({
    data: [
      { name: '对中控制', detail: '前轮X轴 = 3.010，后轮X轴 = 13.010' },
      { name: 'ACC', detail: 'X轴 = 23.010，Y轴 = 33.010，Z轴 = 43.010，R轴 = 53.010' },
      { name: 'ACCBack', detail: 'X轴 = 23.010，Y轴 = 33.010，Z轴 = 43.010，R轴 = 53.010' },
      {
        name: 'ACCAngle',
        detail: '左角雷达X轴 = 23.010，左角雷达Y轴 = 33.010，左角雷达Z轴 = 43.010'
      },
      { name: 'LDW1', detail: 'X轴 = 64.010，Y轴 = 74.010，Z轴 = 84.010' },
      { name: 'LDWBack1', detail: 'X轴 = 64.010，Y轴 = 74.010，Z轴 = 84.010' },
      { name: 'LDW2', detail: 'X轴 = 94.010，Y轴 = 104.010，Z轴 = 114.010' },
      { name: '吸波棉(BSD)(前)', detail: 'x轴 = 124.010，y轴 = 134.010，z轴 = 143.010' }
    ]
  })
})

app.get('/api/rightList', (req, res) => {
  res.json({
    data: [
      { name: 'OBD手柄状态', detail: 'OBD手柄就位' },
      { name: '卷帘门', detail: '' },
      { name: '吸波棉(周围)', detail: '' },
      { name: '工作台', detail: '' },
      { name: '对中', detail: '' },
      { name: '自定义行为0', detail: '' },
      { name: '自定义行为1', detail: '' },
      { name: '自定义行为2', detail: '' },
      { name: '自定义行为3', detail: '' }
    ]
  })
})
app.listen(port, () => {
  console.log(`Mock server listening at http://localhost:${port}`)
})
